Programming Languages Section

Rust

Card image
Post by Amina Delali, September 18th,2021

Some Facts

Rust is a multi-paradigm programming language that allows you to build reliable and efficient software. It is used by Firefox, Dropbox ,Cloudflare, and many other companies.It is a statically-typed programming language designed to empower safe concurrency and memory management.

Rust is a system-level programming language that can be used  for game engines, operating systems, file systems, and enterprise systems. As well as for embedded systems, simulation engines, and browser components.



How to install it

  • on Windows:

     Simply download and run the Rust installer available in this page.

  • on ubuntu :
    1. Open the terminal and run the following command:

      curl --proto '=https' --tlsv1.2 -sSf <https://sh.rustup.rs> | sh

      A list of options will be printed on the screen, you can select option number 1 for the default installation.

    2. Then you will have to either restart the shell, so the new $PATH value will take effect. But if you want to use the current shell, simply run the following command: source $HOME/.cargo/env
    3. To verify the installation, run the following command:

      rustc --version

    For more details about the installation on Ubuntu, you can check this installation page.

In the video below, the details of the installation of the Rustlanguage on Ubuntu.

The Hello World Example

  1. Create a new file in the Home folder, and save it under the name “Hello.rs
  2. Write the following code in the Hello.rs file:
    fn main(){
        println!("Hello World!")
    }
  3. To compile and generate a binary for your code, just open the terminal and run the following command: rustc hello.rs
  4. To execute the binary just run the following command:
  5. ./hello

For more details about the code, you can visit this page.

Additional Information

Something to say ?

If you want to add something about the Rust language or about this post, please feel free to do it by commenting below 🙂 .